package com.hua.designpattern.structural.composite;

import java.util.ArrayList;
import java.util.List;

public class BaseObject {
	private String name;
	private String level;
	private List<BaseObject> children;

	public BaseObject(String name, String level) {
		super();
		this.name = name;
		this.level = level;
		children = new ArrayList<BaseObject>();
	}

	public void addChild(BaseObject child) {
		children.add(child);
	}

	public void removeChild(BaseObject child) {
		children.remove(child);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}

	public List<BaseObject> getChildren() {
		return children;
	}

	public void setChildren(List<BaseObject> children) {
		this.children = children;
	}

	@Override
	public String toString() {
		return super.toString() + "[name:" + name + " level:" + " child number:" + children.size() + "]";
	}

}
